package com.elektronikforumet.camalert;


public class SpeedCamera {

	/**
	 * Uninitialized direction constant
	 */
	public static final int DIRECTION_NONE = -1;
	
	/**
	 * North direction constant
	 */
	public static final int DIRECTION_NORTH = 0;
	
	/**
	 * East direction constant
	 */
	public static final int DIRECTION_EAST = 1;
	
	/**
	 * South direction constant
	 */
	public static final int DIRECTION_SOUTH = 2;
	
	/**
	 * West direction constant
	 */
	public static final int DIRECTION_WEST = 3;
	
	private int mId = -1;
	private Coordinate mLocation = null;
	private int mSpeed = -1;
	private int mDirection = -1;
	private String mRoadNumber = "";
	private int mCameraNumber = -1;
	private boolean mDeleted = false;
	
	/**
	 * Empty constructor
	 */
	public SpeedCamera() {
		
	}

	/**
	 * Get the global id (from webservice) of this camera
	 * @return Global id from webservice
	 */
	public int getId() {
		return mId;
	}  

	/**
	 * Set the global id (from webservice) of this camera
	 * @param id Global id from webservice
	 */
	public void setId(int id) {
		this.mId = id;
	}

	/**
	 * Get the location of the camera
	 * 
	 * @return Location object with information on the camera's whereabouts
	 */
	public Coordinate getLocation() {
		return mLocation;
	}

	/**
	 * Set the camera location
	 * 
	 * @param location new location of camera
	 */
	public void setLocation(Coordinate location) {
		this.mLocation = location;
	}
	
	/**
	 * Set the longitude part of this cameras location
	 * 
	 * @param longitude Camera longitude
	 */
	public void setLongitude(float longitude) {
		if(mLocation == null) {
			mLocation = new Coordinate(longitude, 0);
		} else {
			mLocation.setLongitude(longitude);
		}
	}
	
	/**
	 * Set the latitude part of this camera's location
	 * 
	 * @param latitude Camera latitude
	 */
	public void setLatitude(float latitude) {
		if(mLocation == null) {
			mLocation = new Coordinate(0.0f, latitude);
		} else {
			mLocation.setLatitude(latitude);
		}
	}

	/**
	 * Get speed limit where the camera is placed
	 * 
	 * @return Speed limit in km/h
	 */
	public int getSpeed() {
		return mSpeed;
	}

	/**
	 * Set speed limit where the camera is placed
	 * @param speed Speed limit in km/h
	 */
	public void setSpeed(int speed) {
		this.mSpeed = speed;
	}

	/**
	 * Get the direction in which the camera is facing
	 * 
	 * This function returns an integer representing the constants:
	 * DIRECTION_NONE
	 * DIRECTION_NORTH
	 * DIRECTION_EAST
	 * DIRECTION_SOUTH
	 * DIRECTION_WEST
	 * 
	 * @return Direction of camera
	 */
	public int getDirection() {
		return mDirection;
	}

	/**
	 * Set the direction in which the camera is facing
	 * 
	 * This function expects an integer parameter representing the constants:
	 * DIRECTION_NONE
	 * DIRECTION_NORTH
	 * DIRECTION_EAST
	 * DIRECTION_SOUTH
	 * DIRECTION_WEST
	 * 
	 * @param direction
	 */
	public void setDirection(int direction) {
		this.mDirection = direction;
	}

	/**
	 * Get the road number where the camera is placed
	 * 
	 * @return Road number as a string
	 */
	public String getRoadNumber() {
		return mRoadNumber;
	}

	/**
	 * Set the road number where the camera is placed
	 * 
	 * @param roadNumber Road number as a string
	 */
	public void setRoadNumber(String roadNumber) {
		this.mRoadNumber = roadNumber;
	}
	
	/**
	 * Get the camera number 
	 * 
	 * @return Camera number as an integer
	 */
	public int getCameraNumber() {
		return mCameraNumber;
	}

	/**
	 * Set the camera number 
	 * 
	 * @param cameraNumber Camera number as an integer
	 */
	public void setCameraNumber(int cameraNumber) {
		this.mCameraNumber = cameraNumber;
	}

	/**
	 * If this is true the camera is deleted in the webservice database
	 * 
	 * @return True if the camera is deleted on the web
	 */
	public boolean isDeleted() {
		return mDeleted;
	}

	/**
	 * If this is true the camera is deleted in the webservice database
	 * 
	 * @param deleted True or false if hte camera is deleted on the webservice
	 */
	public void setDeleted(boolean deleted) {
		this.mDeleted = deleted;
	}
}
